package com.pj.compose.ui.page.main


import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.navigation.NavController
import com.blankj.utilcode.util.ActivityUtils
import com.blankj.utilcode.util.ToastUtils
import com.pj.compose.MainActivity
import com.pj.compose.NavRouters
import com.pj.compose.R
import com.pj.compose.activity.BluetoothActivity
import com.pj.compose.model.TextIconEntity
import com.pj.compose.ui.compose.CommonTopBar
import com.pj.compose.ui.compose.MainGridView

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun OtherPage(navController: NavController) {
    val gridItems = listOf(
        TextIconEntity(NavRouters.CHANGE_THEME_PAGE, R.mipmap.icon_grid_color_helper),
        TextIconEntity(stringResource(id = R.string.bluetooth), R.drawable.baseline_bluetooth),
//        TextIconEntity("第三页", R.drawable.ic_tab_other),
//        TextIconEntity("第四页", R.drawable.ic_tab_other),
//        TextIconEntity("第五页", R.drawable.ic_tab_other),
//        TextIconEntity("第六页", R.drawable.ic_tab_other),
    )
    Scaffold(
        modifier = Modifier.fillMaxSize(),
        topBar = {
            CommonTopBar(title = "其它", useBack = false)
        }) { padding ->
        Column(modifier = Modifier.padding(padding)) {
            MainGridView(items = gridItems) { position ->
                when (position) {
                    0 -> navController.navigate(gridItems[position].label)
                    1 -> (ActivityUtils.getTopActivity() as MainActivity).startBluetoothActivity()
                    else -> ToastUtils.showLong("未设置跳转")
                }
            }
        }
    }
}